com.supermap.ar.areffect
Class AREffectElement
- java.lang.Object
-
- com.supermap.ar.areffect.AREffectElement
-
- Direct Known Subclasses:
- ARGltfElement, ARMapElement, ARParticleElement, ARVideoElement, ARVideoElement2, ARViewElement
public class AREffectElement extends java.lang.Object
AR special object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static interface
AREffectElement.onRenderableLoadCompleteListener
Resource load listenerstatic interface
AREffectElement.OnTapListener
The click listener interfacestatic interface
AREffectElement.OnTouchListener
The touch listener interfacestatic class
AREffectElement.PositionType
The displaying position types
-
Constructor Summary
Constructors Constructor and Description AREffectElement(android.content.Context context)
Construction method
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description boolean
addChild(AREffectElement obj)
Adds sub objectsvoid
addChilds(java.util.ArrayList<AREffectElement> list)
Sets the sub object arrayvoid
addOnTapListener(AREffectElement.OnTapListener listener)
Adds a click listenervoid
addOnTouchListener(AREffectElement.OnTouchListener listener)
Sets the touch listenervoid
clearAllChilds()
Clears all sub objectsvoid
destroy()
Destruction of objectsjava.util.ArrayList<AREffectElement>
getAllChilds()
Gets the sub object arrayAREffectElement
getChild(int index)
Searches sub objects according to serial numberAREffectElement
getChild(long id)
Gets sub objects according to their idjava.util.ArrayList<AREffectElement>
getChild(java.lang.String Name)
Gets the sub objectsint
getChildCount()
Gets the number of sub objectsElementType
getElementType()
Get the element typelong
getId()
Gets idfloat[]
getLocalScaleFactor()
Gets the scale of the object in the AR worldAREffectElement.onRenderableLoadCompleteListener
getOnRenderableLoadCompleteListener()
Gets the listening event that the resource has completed loadingPoint3D
getPosition()
Gets the position of AR object on the AR sceneAREffectElement.PositionType
getPositionType()
Gets the display type of positionPoint3D
getRelativePosition()
Gets the position of AR object relative to its parent nodefloat
getRotationAngle()
Returns the rotation angleVector
getRotationAxis()
Returns rotating vectorfloat[]
getScaleFactor()
Gets the ratio of object in ar worldLocation
getWGSCoordinates()
Gets geographical position of modelboolean
isShadowCaster()
Determines whether the element can cast shadows in the sceneboolean
isShadowReceiver()
Determines whether this element can accept shadows from other elements in the sceneboolean
isTransformable()
boolean
isVisible()
Gets whether it is visiblevoid
removeChild(AREffectElement element)
Removes child node elementsvoid
removeChild(int index)
Deletes sub objectsvoid
removeChild(long id)
Deletes sub objectsvoid
removeChild(java.lang.String Name)
Deletes sub objectsvoid
removeOnTapListener()
Removes the click listenervoid
removeOnTouchListener()
Removes the touch listenervoid
setElementName(java.lang.String objectName)
Gets object's namevoid
setLocalScaleFactor(float[] scales)
Sets the scale of objects in the AR worldvoid
setOnRenderableLoadCompleteListener(AREffectElement.onRenderableLoadCompleteListener onRenderableLoadCompleteListener)
Set the listening event for the completion of resource loading Support elements:ARViewElement
ARVideoElement
ARVideoElement2
ARGltfElement
ARWebViewElement
Often used to listen for loading of Android View and Gltf modelsvoid
setParentNode(EffectElement arEffectElement)
Relative layout.void
setParentNode(EffectView arEffectView)
Absolute layout.AREffectElement
setParentNode(EffectView arEffectView, Node parent)
Binds elements to other nodes in the viewvoid
setPosition(Point3D position)
Sets the position of AR object on the AR scenevoid
setRelativePosition(Point3D position)
Sets the position of AR object relative to its parent nodevoid
setRelativePosition(Vector3 position)
Sets the position of the AR object relative to the parent node * @param positionvoid
setRotateAlwaysToCamera(boolean alwaysToCamera)
Sets whether the attitude of the element is always relative to the camera positionvoid
setRotateToCameraType(Node.RotateToCameraType type)
Set the position of the node relative to the camera : Horizontal, Vertical, Horizontal_Verticalvoid
setRotationAngle(Vector vector, float rotationAngle)
Sets the rotation anglevoid
setScaleFactor(float[] scales)
Sets the ratio of object in ar worldvoid
setShadowCaster(boolean flag)
Sets whether shadows can be cast in the scenevoid
setShadowReceiver(boolean flag)
Sets whether shadows from other objects can be accepted in the scenevoid
setTransformable(boolean isTransformable)
Sets the model status (whether users can zoom and rotate models with gestures)void
setVisiblity(boolean visiblity)
Sets whether it is visible.void
setWGSCoordinates(Location elementLocation)
Sets model position using geographical coordinates
-
-
-
Constructor Detail
-
AREffectElement
public AREffectElement(android.content.Context context)
Construction method- Parameters:
context
- The context.
-
-
Method Detail
-
getId
public long getId()
Gets id- Returns:
-
setElementName
public void setElementName(java.lang.String objectName)
Gets object's name- Parameters:
objectName
-
-
addChild
public boolean addChild(AREffectElement obj)
Adds sub objects- Parameters:
obj
- sub objects- Returns:
- whether the adding is successful.
-
getChild
public AREffectElement getChild(int index)
Searches sub objects according to serial number- Parameters:
index
- the sequence number- Returns:
- Sub object.
-
removeChild
public void removeChild(int index)
Deletes sub objects- Parameters:
index
-
-
removeChild
public void removeChild(long id)
Deletes sub objects- Parameters:
id
-
-
removeChild
public void removeChild(java.lang.String Name)
Deletes sub objects- Parameters:
name
-
-
clearAllChilds
public void clearAllChilds()
Clears all sub objects
-
getAllChilds
public java.util.ArrayList<AREffectElement> getAllChilds()
Gets the sub object array- Returns:
-
addChilds
public void addChilds(java.util.ArrayList<AREffectElement> list)
Sets the sub object array- Parameters:
list
-
-
getChildCount
public int getChildCount()
Gets the number of sub objects- Returns:
-
getChild
public java.util.ArrayList<AREffectElement> getChild(java.lang.String Name)
Gets the sub objects- Parameters:
name
-- Returns:
-
getChild
public AREffectElement getChild(long id)
Gets sub objects according to their id- Parameters:
id
-- Returns:
-
getPosition
public Point3D getPosition()
Gets the position of AR object on the AR scene- Returns:
-
setPosition
public void setPosition(Point3D position)
Sets the position of AR object on the AR scene- Parameters:
position
-
-
getWGSCoordinates
public Location getWGSCoordinates()
Gets geographical position of model- Returns:
-
setWGSCoordinates
public void setWGSCoordinates(Location elementLocation)
Sets model position using geographical coordinates- Parameters:
elementLocation
-
-
getRelativePosition
public Point3D getRelativePosition()
Gets the position of AR object relative to its parent node- Returns:
-
setRelativePosition
public void setRelativePosition(Point3D position)
Sets the position of AR object relative to its parent node- Parameters:
position
-
-
getRotationAxis
public Vector getRotationAxis()
Returns rotating vector- Returns:
-
getRotationAngle
public float getRotationAngle()
Returns the rotation angle- Returns:
-
setRotationAngle
public void setRotationAngle(Vector vector, float rotationAngle)
Sets the rotation angle- Parameters:
vector
- the rotation axis. you can use unit vector directlyrotationAngle
- the rotation angle
-
getScaleFactor
public float[] getScaleFactor()
Gets the ratio of object in ar world- Returns:
-
setScaleFactor
public void setScaleFactor(float[] scales)
Sets the ratio of object in ar world- Parameters:
scales
- including 3 values that are coefficients of x, y, and z
-
getPositionType
public AREffectElement.PositionType getPositionType()
Gets the display type of position- Returns:
-
setParentNode
public void setParentNode(EffectView arEffectView)
Absolute layout. Sets parent nodes- Parameters:
arEffectView
-
-
setParentNode
public void setParentNode(EffectElement arEffectElement)
Relative layout. Sets parent nodes- Parameters:
arEffectElement
-
-
setVisiblity
public void setVisiblity(boolean visiblity)
Sets whether it is visible. The visibility of each sub object changes over the changes of parent objects- Parameters:
visiblity
-
-
isVisible
public boolean isVisible()
Gets whether it is visible- Returns:
-
isTransformable
public boolean isTransformable()
-
setTransformable
public void setTransformable(boolean isTransformable)
Sets the model status (whether users can zoom and rotate models with gestures)- Parameters:
isTransformable
-
-
addOnTapListener
public void addOnTapListener(AREffectElement.OnTapListener listener)
Adds a click listener- Parameters:
listener
-
-
removeOnTapListener
public void removeOnTapListener()
Removes the click listener
-
addOnTouchListener
public void addOnTouchListener(AREffectElement.OnTouchListener listener)
Sets the touch listener- Parameters:
listener
-
-
removeOnTouchListener
public void removeOnTouchListener()
Removes the touch listener
-
getElementType
public ElementType getElementType()
Get the element type- Returns:
-
removeChild
public void removeChild(AREffectElement element)
Removes child node elements- Parameters:
element
-
-
setLocalScaleFactor
public void setLocalScaleFactor(float[] scales)
Sets the scale of objects in the AR world
-
getLocalScaleFactor
public float[] getLocalScaleFactor()
Gets the scale of the object in the AR world- Returns:
-
setRelativePosition
public void setRelativePosition(Vector3 position)
Sets the position of the AR object relative to the parent node * @param position
-
setShadowCaster
public void setShadowCaster(boolean flag)
Sets whether shadows can be cast in the scene- Parameters:
flag
-
-
setShadowReceiver
public void setShadowReceiver(boolean flag)
Sets whether shadows from other objects can be accepted in the scene- Parameters:
flag
-
-
isShadowCaster
public boolean isShadowCaster()
Determines whether the element can cast shadows in the scene- Returns:
-
isShadowReceiver
public boolean isShadowReceiver()
Determines whether this element can accept shadows from other elements in the scene- Returns:
-
destroy
public void destroy()
Destruction of objects
-
setRotateAlwaysToCamera
public void setRotateAlwaysToCamera(boolean alwaysToCamera)
Sets whether the attitude of the element is always relative to the camera position- Parameters:
alwaysToCamera
-
-
setRotateToCameraType
public void setRotateToCameraType(Node.RotateToCameraType type)
Set the position of the node relative to the camera: Horizontal, Vertical, Horizontal_Vertical
- Parameters:
type
-
-
getOnRenderableLoadCompleteListener
public AREffectElement.onRenderableLoadCompleteListener getOnRenderableLoadCompleteListener()
Gets the listening event that the resource has completed loading- Returns:
-
setOnRenderableLoadCompleteListener
public void setOnRenderableLoadCompleteListener(AREffectElement.onRenderableLoadCompleteListener onRenderableLoadCompleteListener)
Set the listening event for the completion of resource loadingSupport elements:
ARViewElement
ARVideoElement
ARVideoElement2
ARGltfElement
ARWebViewElement
Often used to listen for loading of Android View and Gltf models- Parameters:
onRenderableLoadCompleteListener
-
-
setParentNode
public AREffectElement setParentNode(EffectView arEffectView, Node parent)
Binds elements to other nodes in the view- Parameters:
arEffect
- View View parameter.parent
-Node
Use this method to bind elements directly to nodes If
EffectView
is not null,hen the binding relation:AREffectElement->parentNode->EffectView- Returns:
-
-